package com.cloudpivot.receivales.contract.view;

import lombok.Getter;
import lombok.Setter;
import org.apache.http.annotation.Contract;

/**
 * U8销售合同类型 转换
 * k =oa类别
 * v =u8类别
 */
public enum ContractType {
    ONE("0","预合同"),
    TWO("1", "内部合同"),
    THREE("2","购销合同"),
    ;

    @Getter
    @Setter
    private String k;

    @Getter
    @Setter
    private String v;

    ContractType(String k, String v) {
        this.k=k;
        this.v=v;
    }

    public static String getKey(String v) {
        if (v == null) {
            return null;
        }else{
            for (ContractType eNum : ContractType.values()) {
                if (v.equals(eNum.getV())) {
                    return eNum.getK();
                }
            }
        }
        return null;
    }

    public static String getValue(String k) {
        if (k == null) {
            return null;
        } else {
            for (ContractType eNum : ContractType.values()) {
                if (k.equals(eNum.getK())) {
                    return eNum.getV();
                }
            }
        }
        return null;
    }

}
